{% extends 'bookcopy_base.html' %}

{% block header %}{% if for_whom %} {{ for_whom }} {% else %} Book reservation {% endif %} {% endblock %}

{% block form %}
    {% if reserved.msg %}
        <b>{{ reserved.msg }}.</b>
    {% else %}
        {% if reserved.error %}
            {{ reserved.error }}
        {% endif %}
        <div class='content_form' style='margin-top: 1em'>
            <form action='.' method='post'>
                <table>
                    <tr>
                        <td>From: </td>
                        <td><input type='text' maxlength='10' name='from' value='' onClick='showKal(this)'></td>
                        <td>(Leave empty for today)</td>
                        {% if perms.baseapp.add_rental %}
                            <td>(Ignored if renting. You always rent from today)</td>
                        {% endif %}
                    </tr>
                    <tr>
                        <td>To: </td>
                        <td><input type='text' maxlength='10' name='to' value='' onClick='showKal(this)'></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>YYYY-MM-DD</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type='submit' name='action' value='reserve' {% if not can_reserve %} disabled {% endif %}  ></td>
                        <td></td>
                    </tr>
                    {% if perms.baseapp.add_rental %}
                        <tr>
                            <td></td>
                            <td><input type='submit' name='action' value='rent' {% if not rental_possible %} disabled {% endif %} ></td>
                            <td></td>
                            {% if display_tips %}
                            <div class="tip">
                                <ol>
                                    <li>
                                        When renting "From:" field is ignored - books are always rented from today.
                                    </li>
                                    <li>
                                        When renting "To:" field means until when you rent the book. When left blank max available period is set.
                                    </li>
                                    <li>
                                        When renting and "To:" field is set to longer than max available period, max available period is used instead.
                                    </li>
                                </ol>
                            </div>
                            {% endif %}
                    {% endif %}
                        </tr>
                </table>
            </form>
        </div>
    {% endif %}

{% endblock %}
